/*
Copyright (C) 1996-1997 Id Software, Inc.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

#include "fxVSIncludes.fx"

struct PS_MESH
{
	float4 Position: SV_POSITION;
	float2 TexCoord: TEXCOORD0;
	float3 Normal: TEXCOORD1;
};

struct PS_LUMA
{
	float4 Position: POSITION0;
	float2 TexCoord: TEXCOORD0;
};


#ifdef VERTEXSHADER
PS_MESH MeshVS (MESH_VS vs_in)
{
	PS_MESH vs_out;

	float4 LerpedPosition = lerp (vs_in.Position0, vs_in.Position1, lerpBlend);

	vs_out.Position = mul (EntityMatrix, mul (LocalMatrix, LerpedPosition));
	vs_out.TexCoord = vs_in.TexCoord;
	vs_out.Normal = lerp (vs_in.Normal0, vs_in.Normal1, lerpBlend);

	return vs_out;
}

float4 MeshZFillVS (MESH_VS vs_in) : SV_POSITION
{
	return mul (EntityMatrix, mul (LocalMatrix, lerp (vs_in.Position0, vs_in.Position1, lerpBlend)));
}
#endif


#ifdef PIXELSHADER
float4 MeshPS (PS_MESH ps_in) : SV_TARGET0
{
	float4 DiffColour = surfTexture.Sample (surfSampler, ps_in.TexCoord);
	return float4 (DiffColour.rgb * ShadeLight * PS_GetShadeDot (ps_in.Normal, ShadeVector), Alpha);
}

float4 MeshLumaPS (PS_MESH ps_in) : SV_TARGET0
{
	return surfTexture.Sample (surfSampler, ps_in.TexCoord);
}
#endif

